//
//  BodayFileViewMode.m
//  fitness-iOS
//
//  Created by 卢仕彤 on 2017/12/16.
//  Copyright © 2017年 卢仕彤. All rights reserved.
//

#import "BodayFileViewMode.h"
#import "UIColor+Expand.h"

@implementation BodayFileViewMode

@end

@interface BodayFileHeadCell ()
@property (nonatomic, strong) UILabel *leftLabel;
@end

@implementation BodayFileHeadCell

#pragma mark lazyinit

- (UILabel *) leftLabel{
    if (!_leftLabel) {
        _leftLabel = [UILabel labelWithSystemFontSize:16 textColorHexString:@"#333333"];
    }
    return _leftLabel;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
    }
    return self;
}

- (void)initView {
    [self.contentView addSubview:self.leftLabel];
    self.leftLabel.text = @"身体数据";
    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(15);
        make.centerY.equalTo(self.contentView.centerY);
    }];
}

@end

@interface BodayFileInfoCell ()

@property (nonatomic, strong) UIImageView *rightImageView;

@end

@implementation BodayFileInfoCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self initView];
    }
    return self;
}

- (void)initView {
    [self.contentView addSubview:self.leftPicImageView];
    self.leftPicImageView.image = [UIImage imageNamed:@"body_height_pic"];
    [self.leftPicImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(8);
        make.size.equalTo(CGSizeMake(20, 20));
        make.centerY.equalTo(self.contentView.centerY);
    }];
    
    [self.contentView addSubview:self.leftLabel];
    [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftPicImageView.right).offset(10);
        make.centerY.equalTo(self.contentView.centerY);
    }];
    
    [self.contentView addSubview:self.rightImageView];
    [_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.right.equalTo(self.contentView.mas_right).offset(-15);
        make.size.mas_equalTo(CGSizeMake(22, 22));
    }];
    
    [self.contentView addSubview:self.rightLabel];
    [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.centerY);
        make.right.equalTo(self.rightImageView.left).offset(-8);
    }];
    
    
    UIView *lineView = [UIView new];
    [self.contentView addSubview:lineView];
    lineView.backgroundColor = [UIColor colorWithHexString:@"#FAFAFA"];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(10);
        make.right.equalTo(self.contentView.right);
        make.bottom.equalTo(self.contentView.bottom);
        make.height.equalTo(@(1));
    }];
}

- (UIImageView *)leftPicImageView {
    if (!_leftPicImageView) {
        _leftPicImageView = [UIImageView new];
        _leftPicImageView.contentMode = UIViewContentModeScaleToFill;
    }
    return _leftPicImageView;
}


- (UILabel *) leftLabel{
    if (!_leftLabel) {
        _leftLabel = [UILabel labelWithSystemFontSize:18 textColorHexString:@"#333333"];
    }
    return _leftLabel;
}

- (UILabel *)rightLabel {
    if (!_rightLabel) {
        _rightLabel = [UILabel labelWithSystemFontSize:23 textColorHexString:@"#3E3846"];
        _rightLabel.font = [UIFont boldSystemFontOfSize:23];
        _rightLabel.text = @"1425";
    }
    return _rightLabel;
}

- (UIImageView *)rightImageView {
    if (!_rightImageView) {
        _rightImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right_arrow"]];
        _rightImageView.contentMode = UIViewContentModeCenter;
    }
    return _rightImageView;
}

@end
